﻿namespace WMS6.Web.Configuration
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class LocAddrQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlAddress;
        protected DropDownList ddlCity;
        protected DropDownList ddlContactName;
        protected DropDownList ddlEmail;
        protected DropDownList ddlFax;
        protected DropDownList ddlIsActive;
        protected DropDownList ddlIsActiveOper;
        protected DropDownList ddlLocAddrID;
        protected DropDownList ddlLocSiteID;
        protected DropDownList ddlProvince;
        protected DropDownList ddlTel;
        protected DropDownList ddlZip;
        protected HtmlForm F2260;
        protected HtmlInputHidden hdnActionID;
        protected Label lblAddress;
        protected Label lblBu;
        protected Label lblCity;
        protected Label lblContactName;
        protected Label lblEmail;
        protected Label lblFax;
        protected Label lblIsActive;
        protected Label lblLocAddrID;
        protected Label lblLocSiteID;
        protected Label lblProvince;
        protected Label lblTel;
        protected Label lblZip;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtAddress;
        protected TextBox txtCity;
        protected TextBox txtContactName;
        protected TextBox txtEmail;
        protected TextBox txtFax;
        protected TextBox txtLocAddrID;
        protected TextBox txtLocSiteID;
        protected TextBox txtProvince;
        protected TextBox txtTel;
        protected TextBox txtZip;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("LocAddrList.aspx?action={0}&from=list&Type={1}", base.UrlEncode(this.hdnActionID.Value.Trim()), base.Request.QueryString["TYPE"]), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("LocAddrList.aspx?action={0}&Type={1}", base.UrlEncode(this.hdnActionID.Value.Trim()), base.Request.QueryString["TYPE"]), false);
        }

        private void LoadDll()
        {
            base.InitQueryDDL(this.ddlLocAddrID, 0);
            base.InitQueryDDL(this.ddlLocSiteID, 0);
            base.InitQueryDDL(this.ddlContactName, 0);
            base.InitQueryDDL(this.ddlTel, 0);
            base.InitQueryDDL(this.ddlEmail, 0);
            base.InitQueryDDL(this.ddlFax, 0);
            base.InitQueryDDL(this.ddlProvince, 0);
            base.InitQueryDDL(this.ddlCity, 0);
            base.InitQueryDDL(this.ddlZip, 0);
            base.InitQueryDDL(this.ddlAddress, 0);
            base.InitQueryDDL(this.ddlIsActiveOper, 0);
            base.InitIsActiveDDL(this.ddlIsActive, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDll();
                if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
                {
                    this.btnExport.Visible = false;
                    this.btnNew.Visible = false;
                    this.ddlIsActive.SelectedValue = "Y";
                    this.ddlIsActive.Enabled = false;
                }
            }
        }

        public string Address
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAddress.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAddress.Text.Trim(), this.ddlAddress.SelectedValue);
                }
                return "";
            }
        }

        public string City
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCity.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCity.Text.Trim(), this.ddlCity.SelectedValue);
                }
                return "";
            }
        }

        public string ContactName
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtContactName.Text.Trim()))
                {
                    return base.GetParamsString(this.txtContactName.Text.Trim(), this.ddlContactName.SelectedValue);
                }
                return "";
            }
        }

        public string Email
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEmail.Text.Trim()))
                {
                    return base.GetParamsString(this.txtEmail.Text.Trim(), this.ddlEmail.SelectedValue);
                }
                return "";
            }
        }

        public string Fax
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtFax.Text.Trim()))
                {
                    return base.GetParamsString(this.txtFax.Text.Trim(), this.ddlFax.SelectedValue);
                }
                return "";
            }
        }

        public string IsActive
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsActive.SelectedValue))
                {
                    return base.GetParamsString(this.ddlIsActive.SelectedValue, this.ddlIsActiveOper.SelectedValue);
                }
                return "";
            }
        }

        public string LocAddrID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLocAddrID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLocAddrID.Text.Trim(), this.ddlLocAddrID.SelectedValue);
                }
                return "";
            }
        }

        public string LocSiteID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLocSiteID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLocSiteID.Text.Trim(), this.ddlLocSiteID.SelectedValue);
                }
                return "";
            }
        }

        public string Province
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtProvince.Text.Trim()))
                {
                    return base.GetParamsString(this.txtProvince.Text.Trim(), this.ddlProvince.SelectedValue);
                }
                return "";
            }
        }

        public string Tel
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtTel.Text.Trim()))
                {
                    return base.GetParamsString(this.txtTel.Text.Trim(), this.ddlTel.SelectedValue);
                }
                return "";
            }
        }

        public string Zip
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtZip.Text.Trim()))
                {
                    return base.GetParamsString(this.txtZip.Text.Trim(), this.ddlZip.SelectedValue);
                }
                return "";
            }
        }
    }
}

